package org.yjc.service;

import java.util.Optional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.yjc.entity.EndUser;
import org.yjc.entity.SysUser;
import org.yjc.repository.EndUserRepository;

@Service
public class EndUserService {
	@Autowired
	private EndUserRepository enduserDAO;

	public Page<EndUser> findAll(Specification spec, Pageable pageable) {
		return enduserDAO.findAll(spec,pageable);
	}

	public void deleteById(Integer id) {
		enduserDAO.deleteById(id);
		
	}

	public EndUser findById(Integer id) {
		Optional<EndUser> optional = enduserDAO.findById(id);
		if(optional.isPresent()) {
			return optional.get();
		}
		return null;
	}

	public void save(EndUser enduser) {
		enduserDAO.save(enduser);
	}

}
